﻿using Axis.BusinessObject.Research;
using Axis.Dao.Research;
using PhuLeBooze.Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Services;
using System.Xml;

namespace PhuLeBooze.Views.Gift.Service
{
    /// <summary>
    /// Summary description for GiftService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class GiftService1 : System.Web.Services.WebService
    {

        [WebMethod(EnableSession = true)]
        public string GetGift(string pProjectID)
        {
            /* Get QueryString to xml */
            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement("InputValue");
            doc.AppendChild(root);
            root.SetAttribute("UserID", CSecurity.USER_ID.ToString());
            root.SetAttribute("SecrectToken", CSecurity.SECRECT_TOKEN.ToString());
            root.SetAttribute("ProjectID", pProjectID);
            string inputValue = root.OuterXml;
            CResearchDao cResearchDao = new CResearchDao();
            IList<CGift> list = cResearchDao.GetGift(inputValue);
            return new JavaScriptSerializer().Serialize(list);
        }
    }
}
